package gui;

import java.awt.Component;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class QueryDateTimePanel extends JPanel{
  private static final long serialVersionUID = 151999493513620493L;

  private JTextField txtStartDate = new JTextField();
  private JTextField txtStartTime = new JTextField();
  private JTextField txtEndDate = new JTextField();
  private JTextField txtEndTime = new JTextField();
  
  public QueryDateTimePanel() {
    super();
    
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    setBorder(BorderFactory.createTitledBorder("Date/Time Settings"));
    setAlignmentX(Component.LEFT_ALIGNMENT);
    
    Dimension dim = new Dimension(290,90);
    setPreferredSize(dim);
    setMaximumSize(dim);
    
    add(getStartDateTime());
    add(Box.createVerticalStrut(10));
    add(getEndDateTime());
  }
  
  private JPanel getStartDateTime() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.LINE_AXIS));
    pnl.setAlignmentX(Component.LEFT_ALIGNMENT);
    pnl.add(new JLabel("Start Date: "));
    pnl.add(txtStartDate);
    pnl.add(new JLabel("Start Time: "));
    pnl.add(txtStartTime);
    return pnl;
  }
  
  private JPanel getEndDateTime() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.LINE_AXIS));
    pnl.setAlignmentX(Component.LEFT_ALIGNMENT);
    pnl.add(new JLabel("End Date: "));
    pnl.add(txtEndDate);
    pnl.add(new JLabel("End Time: "));
    pnl.add(txtEndTime);
    return pnl;
  }
}
